﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using NngLevelEditor.Utility;

namespace NngLevelEditor.Entities
{
    public class FlyingEnemy : Tile
    {
        public float TravelDistance
        {
            get;
            set;
        }

        public bool Horizontal
        {
            get;
            set;
        }

        public FlyingEnemy(int number, string type)
            : base(number, type)
        {
            Number = number;
            Type = type;
            LoadContent();
        }

        public override string GetXml(float minTileX, float minTileY)
        {
            String fileString = "";
            Vector2 xnaPosition = this.Position.ToXnaUnits();
            double tileX = Math.Round((double)(xnaPosition.X / 64) - (double)(minTileX / 64));
            double tileY = Math.Round((double)(xnaPosition.Y / 64) - (double)(minTileY / 64));
            fileString += "<FlyingEnemy>\n";
            fileString += "<X>" + (int)tileX + "</X>\n";
            fileString += "<Y>" + (int)tileY + "</Y>\n";
            fileString += "<TravelDistance>" + this.TravelDistance + "</TravelDistance>\n";
            fileString += "<Horizontal>" + ((this.Number == 1) ? true : false) + "</Horizontal>\n";
            fileString += "</FlyingEnemy>\n";

            return fileString;
        }

    }
}
